<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>读取Cookies</title>
</head>
<body>
	<div style="margin: auto; width: 80%;">
		<%
			Cookie cookie = null;
			Cookie[] cookies = null;

			// Get an array of Cookies associated with the this domain
			cookies = request.getCookies();

			if (cookies != null) {
				out.println("<h2>找到的Cookie名称和值</h2>");

				for (int i = 0; i < cookies.length; i++) {
					cookie = cookies[i];
					out.print("Name : " + cookie.getName() + ",  ");
					out.print("Value: " + cookie.getValue() + " <br/>");
				}
			} else {
				out.println("<h2>No cookies founds</h2>");
			}
		%>
	</div>
</body>
</html>